gtktreeviewaccessible: Fix a potential division by zero
authorPhilip Withnall <philip.withnall@collabora.co.uk>
Wed, 20 Nov 2013 17:25:48 +0000 (17:25 +0000)
committerPhilip Withnall <philip.withnall@collabora.co.uk>
Sun, 24 Nov 2013 21:21:02 +0000 (21:21 +0000)
Found with scan-build.

https://bugzilla.gnome.org/show_bug.cgi?id=712760

gtk/a11y/gtktreeviewaccessible.c

index fb9e2ce2112f2b72e74721a2045a30831886048e..21e86b32e51463c6f4b9d3b4c0441f75ce83bb0c 100644 (file)
@@ -954,7 +954,7 @@ gtk_tree_view_accessible_ref_selection (AtkSelection *selection,
   table = ATK_TABLE (selection);
   n_columns = gtk_tree_view_accessible_get_n_columns (table);
   n_selected = gtk_tree_view_accessible_get_selected_rows (table, &selected);
-  if (i >= n_columns * n_selected)
+  if (n_columns == 0 || i >= n_columns * n_selected)
     return NULL;
 
   row = selected[i / n_columns];